<!-- Guide of Dockerlize

Generated by coz on 2/16/2016,
from a template provided by apeman-bud-wiki.

-->

### 01 - Verify Docker Daemon Running

Before dockerlize the project, check that you have a working install of docker.

```bash
$ docker info
```

If command failed, see the [Docker User Guide](dk_docker_guide_url) and fix it.

[dk_docker_guide_url]: https://docs.docker.com/engine/userguide/basics/


### 02 - Pull and Build Docker Images.

apeman-infr generates infrastructures as Docker images.

Hits the command at your project, and images will be build with "$infr" configurations in the project Apemanfile.

```bash
$ apeman infr
```

This could take a long time, but wait patiently.


### 03 - Run Docker containers.

apeman-dply creates and start Docker containers with images generated by apeman-infr.
It also creates bridge network for communicating between containers.

Hits the command at your project, and containers will be started with "$dply" configurations in the project Apemanfile.

```bash
$ apeman dply
```


### 04 - Configure Host Names

To enable virtual hosting, project domains should be registered in hosts file.(eg: /etc/hosts in linux)

Running "hosts:set" task will write the hosts for this project. Most cases you need `sudo` to do this.

```bash
# Update hosts file to bind domains and Docker host IP
$ sudo apeman task hosts:set
```

Then, check that domains are bound to the Docker host IP.

```bash
$ apeman task hosts:list
```

### 05 - Start proxy

Since containers are not visible from outside world, you need a reverse proxy to make then public.
apeman-prxy start a nginx server and listens 80/443, and handle requests to each domains due to the VIRTUAL_HOST env defined in "$dply" configurations.

```bash
# Start nginx proxy server.
$ apeman prxy
```

Note that this proxy could be shared between multiple apeman web project. Just make sure domain names are distinct.





## Links

+ [Docker](https://www.docker.com/)
+ [apeman-task](https://github.com/apeman-cmd-labo/apeman-task)
+ [apeman-infr](https://github.com/apeman-cmd-labo/apeman-infr)
+ [apeman-dply](https://github.com/apeman-cmd-labo/apeman-dply)
+ [apeman-prxy](https://github.com/apeman-cmd-labo/apeman-prxy)